package com.google.code.gaeom;

/**
 * @author Peter Murray <gaeom@pmurray.com>
 */
public interface Find<T> extends SynchronousTerminator<Iterable<T>>, LoadCommon<Find<T>>
{
	static enum Sort
	{
		Ascending, Descending
	}

	public Find<T> sort(String field);

	public Find<T> sort(String field, Sort direction);

	static enum Op
	{
		LessThan, LessThanOrEqualTo, EqualTo, GreaterThanOrEqualTo, GreaterThan
	}

	public Find<T> filter(String field, Object value);
	
	public Find<T> filter(String field, Op op, Object value);

	public Find<T> filterBetween(String field, Object lower, Object upper);

	public Find<T> filterBetween(String field, Object lower, Object upper, boolean includeBottom, boolean includeTop);
	
	public Find<T> filterBeginsWith(String field, String value);

	public Find<T> ancestor(Object ancestor);

	public Find<T> start(int offset);

	public Find<T> limit(int count);

	public SynchronousTerminator<T> single();

	public SynchronousTerminator<Integer> count();
}
